pp108 : Creating a Data Transformation Model

Creating a Data Transformation Model

This topic describes the procedure to create a data transformation model.

Before you begin this task: You must create required source and target (object templates or schema fragments) which are to be mapped.

Data mapping is the first step in data transformation. Data map is a model that captures the transformation logic between the source and target data models. It is the process of mapping elements of a source data model to elements of a target data model. Data transformation converts data from a source data format into a target data format using XQuery expressions or eXtensible Stylesheet Language Transformations (XSLTs).

Attention:
Depending on how you access the modeler, the way the objects are accessed differs. For example,

  • If you access the modeler from Workspace Documents (Explorer), you can drag the source or target from the workspace explorer tree.
  • If you access the modeler from Workspace Documents (My Recent Documents) view, click on the modeler tool bar, select on the side bar, and drag the required objects to the Source or Target as required.
  1. Access the Data Transformation Modeler () to create a data transformation model. The Data Transformation modeler page is displayed.
  2. Drag the required source schema fragment or object template from the project tree to the Source Template pane of the Modeler tab. The schema of the object is displayed on the modeler.
  3. Drag the required target schema fragment or object template onto the Target Template pane of the Modeler tab. The Transformation Modeler page displays the schema of the selected source and destination templates.
  4. Map (linking the elements) the elements between the source and target templates.
    1. Select the element on the source tree.
    2. Hold the CTRLkey, and select the corresponding element on the target tree. A line appears connecting the mapped elements in the source and target templates.

      Note: While transforming the data, if required, you can have the target XML contain elements even when they are not mapped.

      • Right-click the required element of the Target XML, and select Mandatory.
      • Right-click and select Not Mandatory to remove this option.
  5. To group the mappings using the Group feature, click Create New Group option from the Group drop-down list, provide the group name in the Add Group dialog box, and click OK. A group is created, and all the mappings created after this point will be placed in this group.

    Note:
    A group allows you to identify a collection of maps with a unique identity. This feature is especially helpful when you have to manage a large number of maps. Grouping will reduce the clutter in such cases. You can switch between groups or choose to display all the mappings by selecting the appropriate option in the Group drop-down list. You can move a mapping along with its associated functions from one group to another by right-clicking the link, and selecting Move to Group.

  6. If needed, transform the data using the XSLT function library as described in Transforming Data using XSLT Functions. Alternatively, you may directly edit the XSLT for the transformation model. For more information on the XSLT functions, refer to XSLT Functions
  7. If required, edit the XSLT code for the transformation model on the Edit Model Source tab. Click Validate Model Source to check the accuracy of the XSLT code. The XSLT code of the transformation model is validated. Note: You can debug the XSLT code, if validation on the transformation model fails. For more information on XSLT debugging, refer to testing Web services in related topics section.
  8. Test the transformation model through the Test Model tab as described in Testing a Data Transformation Model.
  9. If required, click Model Source tab to view the XSLT source. The generated XSLT code for the transformation model can be viewed in the Model Sourcetab. You can make the required changes and save.

    Caution:
    After the transformation model is created, if there are any changes made to the elements of the schema fragments, the changes are not automatically reflected in the modeler. For instance, if the name of an element in the schema fragment is changed from ID to Emp ID, then the change is not automatically reflected in the transformation modeler. You must go to the Edit Model Source tab and make the relevant changes to the elements manually.

  10. Click to save the data transformation model.
    The data transformation model is created and is attached to the corresponding project.

 

Identifying the Mappings:
If we want to identify the mappings, like
  • to what all the Target's is the 'Source' Element mapped or
  • from what all the Source's is a particular 'target' is getting mapped,
    if we click on 'Source' or 'Target' element's from the tree, those particular mappings will get highlighted which makes identifying easy.

We can even identify mappings by clicking on a particular 'function', so that all the mappings 'to' and 'from' the function will get highlighted.

 

{scrollbar}

 

 


Related tasks

Creating XML Schema Fragments

Creating an Object Template

Transforming Data using XSLT Functions

Testing a Data Transformation Model

Generating a Web Service Operation on a Data Transformation Model

Extending Custom Functions

Creating a Content Map

 


Related information

Testing Web Service Operations Using Service Test Tool

http://www.w3.org/TR/xslt

XSLT Functions